#pragma once
#include <xpam/exception.h>
namespace xpam
{
    template<class T1, class T2>
    T1 & cast(const T2 & t2)
    {
        if (sizeof(T1) != sizeof(T2))
            throw xpam::exception() << "cast imposible:(wrong type sizes)";
        return *((T1*)((void*)&t2));
    }
}